﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Forms;

namespace Lottery.Herper {
    /// <summary>
    /// Form的助手类
    /// </summary>
    public static class FormHelper {
        /// <summary>
        /// 把窗体设置成为Dialog模式
        /// </summary>
        /// <param name="form"></param>
        public static void SetDialogStyle(this Form form) {
            form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            form.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            form.MaximizeBox = false;
            form.MinimizeBox = false;
            form.ShowInTaskbar = false;
        }

        /// <summary>
        /// 显示提示信息
        /// </summary>
        /// <param name="form"></param>
        /// <param name="info">提示信息</param>
        public static void ShowInfo(this Form form, string info) {
            MessageBox.Show(info, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        /// <summary>
        /// 显示提示信息（Yes、No按钮）
        /// </summary>
        /// <param name="form"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        public static DialogResult ShowYesNoInfo(this Form form, string info) {
            return MessageBox.Show(info, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
        }
    }
}
